package File;

import java.io.FileWriter;
import java.io.IOException;

public class SimpleFile {
    public static void main(String[] args) throws IOException{
        int sum =0;
        for (int i=0;i<=100;i++) {
            sum+=i;
        }
        //输出内容到控制台
        System.out.println("计算结果"+sum);
        FileWriter myfout = new FileWriter("f1.txt");
        myfout.write("计算结果"+sum);
        //必须关闭输出流，才能完成写入文件
        myfout.close();
    }

}
